home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Zoom 2
/
Zoom - Release 2 (1996)(Active Software)[!].iso
/
misc
/
scion409
/
scionarexx.lha
/
Anniversary.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-10-24
|
11KB
|
442 lines
/****************************************************************************/
/* */
/* Anniversary.rexx */
/* */
/* Written by: Peter Billing, RMB 1240, Yinnar 3869, Australia */
/* */
/* Last saved: Wednesday 29-Sep-93 */
/* */
/* This script should tell you the Age of a person in the SCION database. */
/* It does except the date to be in the format DD MMM */
/* The database must be running for this AREXX script to work. */
/* */
/****************************************************************************/
/* Return the Database Name */
options results
/*test = show('P','SCIONGEN')
if test = 0 then
say
say "I am sorry to say that the SCION Genealogist database is not available."
say "Please start the SCION program BEFORE using this script."
say
exit */
myport = "SCIONGEN"
address value myport
getdbname
dbname = upper(result)
output = "STDOUT"
out = "S"
say ""
say center("
Anniversary.rexx
",80)
say
say center("The current database name is "dbname,80)
say "This script will tell you what Anniversaries occurr on a certain date."
say "There are two forms to the date, DD MMM which will give Anniversaries"
say "on that date ONLY and MMM which will give ALL Anniversaries of the Month."
say "All Anniversaries are checked: Birth, Death, Burial and Marriage."
writech(output, "Type in the DATE you are interested in, in the formatt DD MMM. ")
pull Anni_Date
if date1 = "" then exit
writech(output,"Output to Screen or File. S/F ")
pull out
if out = "" then out ="S"
if out = "F" then do
filename = "RAM:Anniversary_"dbname".Scion"
open(w_file,filename,"w")
output = w_file
writeln(stdout,"")
writeln(stdout,"Writing file to" filename)
end
if words(Anni_date) = 1 & Anni_Date ~= "ALL" then do
checkmonth(Anni_Date)
start = x
finish = x
ending = "in the month of "
end
if Anni_Date = "ALL" then do
start = 1
finish = 12
ending = "in the month of "
end
if words(Anni_Date) = 2 then do
checkmonth(subword(Anni_Date,2))
start = x
finish = x
ending = "on this day "
end
date1 = Anni_Date
gettotalirn
total = result
do zz = start to finish
if Anni_Date = "ALL" then do
getmonth(zz)
date1 = m
if out = "F" & zz > 1 then writeln(output,"")
end
say center("Checking the month of "m,80)
writeln(output,"")
writeln(output,center("The following people have birthdays "ending date1".",80))
writeln(output,"-------------------------------------------------------------------------------")
if out = "F" then writech(stdout,"Checking Birth records. ")
printed = 0
fix = 0
do irn = 1 to total
if out = "F" then do
if irn/5 = irn%5 then writech(stdout,".")
if printed = 55 then do
writeln(output,"")
writeln(output,center("The following people have birthdays "ending date1".",80))
writeln(output,"-------------------------------------------------------------------------------")
printed = 0
end
end
date2 = ""
getbirthdate irn
birth = result
checkdate(birth)
if check = "TRUE" then do
MakeName(irn)
getage(irn)
writeln(output,name "["right(irn,3)"]" right(birth,12) " Age: "right(age,3))
printed = printed + 1
fix = 1
end
end
say
if out = "F" then say printed "records found."
if fix = 0 then do
writeln(output,"No birthdays were found on that date.")
end
writeln(output,"===============================================================================")
writeln(output,"")
writeln(output,center("The following people died "ending date1".",80))
writeln(output,"-------------------------------------------------------------------------------")
printed = printed + 4
if out = "F" then writech(stdout,"Checking Death records. ")
fix = 0
do irn = 1 to total
if out = "F" then do
if irn/5 = irn%5 then writech(stdout,".")
if printed >= 55 then do
writeln(output,"")
writeln(output,center("The following people died "ending date1".",80))
writeln(output,"-------------------------------------------------------------------------------")
printed = 0
end
end
date2 = ""
getdeathdate irn
death = result
checkdate(death)
if check = "TRUE" then do
MakeName(irn)
writeln(output,name "["right(irn,3)"]" right(death,12))
printed = printed + 1
fix = 1
end
end
say
if out = "F" then say printed "records found."
if fix = 0 then do
writeln(output,"No Deaths were found on that date.")
end
writeln(output,"===============================================================================")
writeln(output,"")
writeln(output,center("The following people were buried "ending date1".",80))
writeln(output,"-------------------------------------------------------------------------------")
printed = printed + 4
if out = "F" then writech(stdout,"Checking Burial records. ")
fix = 0
do irn = 1 to total
if out = "F" then do
if irn/5 = irn%5 then writech(stdout,".")
if printed >= 55 then do
writeln(output,"")
writeln(output,center("The following people were buried "ending date1".",80))
writeln(output,"-------------------------------------------------------------------------------")
printed = 0
end
end
date2 = ""
getburialdate irn
burial = result
checkdate(burial)
if check = "TRUE" then do
MakeName(irn)
writeln(output,name "["right(irn,3)"]" right(burial,12))
printed = printed + 1
fix = 1
end
end
say
if out = "F" then say printed "records found."
if fix = 0 then do
writeln(output,"No burials were found on that date.")
end
writeln(output,"===============================================================================")
printed = printed + 1
gettotalfgrn
total = result
writeln(output,"")
writeln(output,center("The following people have marriages "ending date1".",80))
writeln(output,"-------------------------------------------------------------------------------")
printed = printed + 4
if out = "F" then writech(stdout,"Checking Marriage records. ")
printed = 0
do fgrn = 1 to total
if out = "F" then do
if irn/5 = irn%5 then writech(stdout,".")
if printed >= 55 then do
writeln(output,"")
writeln(output,center("The following people have marriages "ending date1".",80))
writeln(output,"-------------------------------------------------------------------------------")
printed = 0
end
end
date2 = ""
getmarrydate fgrn
marry = result
checkdate(marry)
if check = "TRUE" then do
getprincipal fgrn
P = result
getspouse fgrn
S = result
MakeName(P)
Name1 = name
MakeName(S)
Name2 = name
getsex P
sex = resut
if sex = "F" then do
temp = name1
name1 = name2
name2 = temp
t = p
p = s
s = t
end
married = "been married for"
years = "years"
GetMarriageLength(fgrn)
if marriagelength > 100 then do
married = ""
marriagelength = ""
years = ""
end
if pcheck = 1 | scheck = 1 then do
married = "were married for"
end
writeln(output,Name1 "["right(p,3)"]" right(marry,12) married marriagelength years)
writeln(output,Name2 "["right(s,3)"]")
writeln(output,"")
printed = printed + 3
end
end
say
if out = "F" then say printed "records found."
if printed = 0 then do
writeln(output,"No marriagies were found on that date.")
end
writeln(output,"===============================================================================")
end
if out = "F" then do
writeln(output,"")
close(w_file)
writeln(stdout,"")
writeln(stdout,"All Finished")
end
exit
MakeName:
parse arg irn
getfirstname irn
name = left(result,18)
getlastname irn
name = name left(result,12)
return name
CheckDate:
parse arg date
if words(date1) = 2 then date2 = word(upper(date),1)
date2 = date2 word(upper(date),2)
if date2 ~= "" & date1 = date2 then do
check = "TRUE"
end
else
check = "FALSE"
return check
CheckMonth:
parse arg m
if m = "JAN" then x = 1
if m = "FEB" then x = 2
if m = "MAR" then x = 3
if m = "APR" then x = 4
if m = "MAY" then x = 5
if m = "JUN" then x = 6
if m = "JUL" then x = 7
if m = "AUG" then x = 8
if m = "SEP" then x = 9
if m = "OCT" then x = 10
if m = "NOV" then x = 11
if m = "DEC" then x = 12
return x
GetMonth:
parse arg z
if z = 1 then m = "JAN"
if z = 2 then m = "FEB"
if z = 3 then m = "MAR"
if z = 4 then m = "APR"
if z = 5 then m = "MAY"
if z = 6 then m = "JUN"
if z = 7 then m = "JUL"
if z = 8 then m = "AUG"
if z = 9 then m = "SEP"
if z = 10 then m = "OCT"
if z = 11 then m = "NOV"
if z = 12 then m = "DEC"
return m
GetAge:
parse arg irn
age = ""
life = ""
day1 = subword(date(),1,1)
Month1 = subword(date(),2,1)
Year1 = subword(date(),3,1)
CheckMonth(upper(Month1))
m1 = x
birth = ""
getbirthdate irn
birth = result
if birth ~= "" then do
if length(birth) > 3 then do
day2 = word(birth,1)
Month2 = substr(word(birth,2),1,3)
Year2 = substr(birth,length(birth)-3,4)
CheckMonth(upper(Month2))
m2 = x
end
death = ""
getdeathdate irn
death = result
if length(death) > 3 then do
day3 = word(death,1)
Month3 = word(death,2)
Year3 = substr(death,length(death)-3,4)
CheckMonth(upper(Month3))
m3 = x
age = year3 - year2
if m3 < m2 then age = age -1
if m3 = m2 then do
if day3 < day2 then age = age -1
end
Life = "D"
end
/* Person is still alive */
if length(death) < 3 & length(birth) > 3 then do
age = year1 - year2
Life = "L"
if m1 < m2 then
age = age -1
if m1 = m2 then do
if day1 < day2 then do
age = age -1
end
end
end
if age > 105 then do
age = ""
Life = ""
end
end
if age > 105 then age = ""
return age
GetMarriageLength:
parse arg fgrn
day1 = subword(date(),1,1)
Month1 = subword(date(),2,1)
Year1 = subword(date(),3,1)
CheckMonth(upper(Month1))
m1 = x
Marriagelength = ""
if marry ~= "" then do
if length(marry) > 3 then do
day2 = word(marry,1)
Month2 = substr(word(marry,2),1,3)
Year2 = substr(marry,length(marry)-3,4)
CheckMonth(upper(Month2))
m2 = x
pcheck = 0
getdeathdate p
if result ~= "" then do
pdate = result
day1 = word(pdate,1)
Month1 = substr(word(pdate,2),1,3)
Year1 = substr(pdate,length(pdate)-3,4)
CheckMonth(upper(pMonth))
m2 = x
pcheck = 1
end
scheck = 0
getdeathdate s
if result ~= "" then do
sdate = result
sday = word(sdate,1)
sMonth = substr(word(sdate,2),1,3)
sYear = substr(sdate,length(sdate)-3,4)
CheckMonth(upper(sMonth))
m3 = x
scheck = 1
end
if pcheck = 1 & scheck = 1 then do
if year1 > syear then do
year1 = syear
month1 = smonth
day1 = sday
end
end
if pcheck = 0 & scheck = 1 then do
year1 = syear
month1 = smonth
day1 = sday
end
/* say "Year1 "year1
say "Year2 "year2 */
marriagelength = year1 - year2
if m1 < m2 then marriagelength = marriagelength -1
if m1 = m2 then do
if day1 < day2 then do
marriagelength = marriagelength -1
end
end
end
end
return marriagelength